from flask import url_for
from flask_restful import Resource

from restful.response import ResponseSuccess
from restful.session import login_required


#TODO
class SystemAllFunctions(Resource):
    @login_required
    def get(self):
        return ResponseSuccess(data=[{
            'img':url_for('static', filename='img/default.png'),
            'title':'标题测试',
            'desc':'描述测试',
            'link':'#'
        },{
            'img':url_for('static', filename='img/default.png'),
            'title':'标题测试',
            'desc':'描述测试',
            'link':'#'
        }])

#TODO
class SystemAllUrls(Resource):
    @login_required
    def get(self):
        return ResponseSuccess(data={
            'page':{
                'login':url_for('page.login'),
                'register':url_for('page.register'),
                'back':{
                    'check':url_for('page.back_check'),
                    'disable':url_for('page.back_disable'),
                },
                'front':{
                    'home':url_for('page.front_home'),
                    'personaldetail':url_for('page.front_personaldetail',uid=0),
                    'blogdetail':url_for('page.front_blogdetail',pid=0),

                    'bloghot':url_for('page.front_bloghot'),
                    'blogrecent':url_for('page.front_blogrecent'),
                    'bloglistbymakefriends':url_for('page.front_bloglistbymakefriends'),
                    'bloglistbyhelp':url_for('page.front_bloglistbyhelp'),
                    'bloglistbytrade':url_for('page.front_bloglistbytrade'),
                    'bloglistbysimilar':url_for('page.front_bloglistbysimilar'),
                    'bloglistbyfollowing':url_for('page.front_bloglistbyfollowing'),

                    'myblogs':url_for('page.front_myblogs'),
                    'mycomments':url_for('page.front_mycomments'),
                    'mylikesfollows':url_for('page.front_mylikesfollows'),
                    'publish_new':url_for('page.front_publish_new'),
                    'edit_old':url_for('page.front_edit_old',pid=0),
                    'data':url_for('page.front_data'),
                    'information':url_for('page.front_information'),
                }
            },

            'service':{
                'login':url_for('serlogin'),
                'adminlogin':url_for('adminlogin'),
                'register':url_for('serregister'),
                'likeorcancel': url_for('likeorcancel'),
                'followorcancel': url_for('followorcancel'),
                'commentorcancel': url_for('commentorcancel'),
                'postdelete': url_for('postdelete'),
                'intro':url_for('intro'),
                'icon':url_for('icon'),
                'background':url_for('background'),
                'role':url_for('role'),
                'publish':url_for('publish'),
            },
            'info':{
                'postslistbysort':url_for('postslistbysort'),
                'postslistbysimilar':url_for('postslistbysimilar'),
                'postslistbymyfollowing':url_for('postslistbymyfollowing'),
                'postslistbytophot':url_for('postslistbytophot'),
                'postslistbytoprecent':url_for('postslistbytoprecent'),
                'myposts':url_for('myposts'),
                'mycomments':url_for('mycomments'),
                'mylikes':url_for('mylikes'),
                'myfollows':url_for('myfollows'),
                'authordetail':url_for('authordetail'),
                'postdetail':url_for('postdetail'),
                'data':url_for('data'),

                'admincheck':url_for('admincheck'),
                'admindisable':url_for('admindisable'),
            }
        })